<template>
  <div class="school">
    <h2>学校名称：{{ schoolName }}</h2>
    <h2>学校地址：{{ schoolAddress }}</h2>
    <!-- <h2>学校地址：{{ schoolAge*1+1 }}</h2>
    <h2>学校地址：{{ schoolAge+1 }}</h2> -->
     <h2>学校地址：{{MyAge}}</h2>
     <h2 v-text="MyAge"></h2>
    <button @click="updateAge">修改年龄</button>
  </div>
</template>

<script>
export default {
  name: "School",
  data () {
      return {
          //schoolAge:"18"//优先接受props
          MyAge:this.schoolAge
      }
  },
  methods: {
      updateAge(){
          console.log(this.MyAge)
          //this.schoolAge=99
          this.MyAge++
      }
  }
,
 props: ['schoolName','schoolAddress','schoolAge'],//简单接受
//   props: {//类型限制
//       schoolName:String,
//       schoolAddress:String,
//       schoolAge:Number
             
//   }
//对数据进行限制+默认值的指定
//   props: {
//       schoolName:{
//           type:String,
//           required:true//名字是必须传
//       },
//       schoolAddress:{
//         type:String,
//           required:true
//       },
//       schoolAge:{
//           type:Number,
//           required:true,
//           default:55//默认值
//       }


//   }
};
</script>

<style>
.school {
  background-color: aqua;
}
</style>
